package com.ruoyi.project.er.controller;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.er.domain.PaeaErError;
import com.ruoyi.project.er.service.IPaeaErErrorService;
import com.ruoyi.project.sdi.input.model.ManualInputBatchInfoVo;
import com.ruoyi.project.system.user.domain.User;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;

import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 督办查询Controller
 *
 * @author XQ.XU
 * @date 2020-03-22
 */
@Controller
@RequestMapping("/er/paeaErError")
public class PaeaErErrorController extends BaseController
{
    private String prefix = "er/paeaErError";

    @Autowired
    private IPaeaErErrorService paeaErErrorService;

    @RequiresPermissions("er:paeaErError:view")
    @GetMapping()
    public String paeaErError()
    {
        return prefix + "/paeaErError";
    }

    /**
     * 查询督办查询列表
     */
    @RequiresPermissions("er:paeaErError:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PaeaErError paeaErError)
    {
        startPage();
        List<PaeaErError> list = paeaErErrorService.list(new QueryWrapper<>(paeaErError));
        return getDataTable(list);
    }

    /**
     * 导出督办查询列表
     */
    @RequiresPermissions("er:paeaErError:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(PaeaErError paeaErError)
    {
        List<PaeaErError> list = paeaErErrorService.list(new QueryWrapper<>(paeaErError));
        ExcelUtil<PaeaErError> util = new ExcelUtil<PaeaErError>(PaeaErError.class);
        return util.exportExcel(list, "paeaErError");
    }
    /**
     * 差错详情
     * @param paeaErError
     * @return
     */
    @GetMapping("/selectPaeaErErrorById/{id}")
    @ResponseBody
    public AjaxResult selectPaeaErErrorById(PaeaErError paeaErError) {
        User user = ShiroUtils.getSysUser();
        return AjaxResult.success(paeaErErrorService.selectPaeaErErrorById(paeaErError.getId()));

    }
    /**
     * 历史督办
     * @param paeaErError
     * @return
     */
    @GetMapping("/selectPaeaErErrorHisListByErrId/{id}")
    @ResponseBody
    public AjaxResult selectPaeaErErrorHisListByErrId(PaeaErError paeaErError) {
        return AjaxResult.success(paeaErErrorService.selectPaeaErErrorHisListByErrId(paeaErError.getId()));
    }

    /**
     * 流水
     * @param errId
     * @return
     */
    @GetMapping("/selectPaeaDsTradeByErrId/{errId}")
    @ResponseBody
    public AjaxResult selectPaeaDsTradeByErrId(@PathVariable("errId") String errId) {
        return AjaxResult.success(paeaErErrorService.selectPaeaErErrorByErrId(errId));

    }
    /**
     * 影像
     * @param errId
     * @return
     */
    @GetMapping("/selectSdiImageListByErrId/{errId}")
    @ResponseBody
    public AjaxResult selectSdiImageListByErrId(@PathVariable("errId") String errId) {
        return AjaxResult.success(paeaErErrorService.selectSdiImageListByErrId(errId));

    }
}
